package priv.wangy.micro.common.po.page;

import lombok.Builder;
import lombok.Data;

/**
 * 排序条件
 *
 * @author zhangjq
 * @since 2024-05-27
 */
@Data
@Builder
public class SortCriteria {

    public interface Order {
        String ASC = "00";
        String DESC = "01";
    }

    /**
     * 排序属性
     */
    private String property;

    /**
     * 排序规则
     * 00:正序
     * 01:逆序
     */
    private String order;

    public static SortCriteria asc(String property) {
        return SortCriteria.builder().property(property).order(Order.ASC).build();
    }

    public static SortCriteria desc(String property) {
        return SortCriteria.builder().property(property).order(Order.DESC).build();
    }
}
